package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func main() {
	file, err := os.Open("tools/clubv2_check/score.txt")
	if err != nil {
		fmt.Println("error opening file", err)
	}
	defer file.Close()

	// 使用 Scanner 逐行读取
	scanner := bufio.NewScanner(file)
	var (
		index = 0
		sum   = 0
	)

	for scanner.Scan() {
		index++
		if index%2 == 1 {
			continue
		}
		fmt.Println(scanner.Text())

		strs := strings.Split(scanner.Text(), ")")
		tmp := strings.ReplaceAll(strs[1], "\"", "")

		num, err := strconv.Atoi(strings.TrimSpace(tmp))
		if err != nil {
			log.Fatal(err)
			continue
		}
		sum += num
	}

	if err := scanner.Err(); err != nil {
		log.Fatal(err)
	}

	if sum == 0 {
		fmt.Println("总计 : ", sum, "符合预期")
	} else {
		fmt.Println("总计 : ", sum, "不符合预期")
	}
}
